home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / docs.lha / hem / user / lisp.mss < prev    next >
Text File  |  1992-02-23  |  35KB  |  823 lines

  1. @comment{-*- Dictionary: /afs/cs/project/clisp/scribe/hem/hem; Mode: spell; Package: Hemlock -*-}
  2. @chap[Interacting With Lisp]
  3. @index[lisp, interaction with]
  4.  
  5. Lisp encourages highly interactive programming environments by requiring
  6. decisions about object type and function definition to be postponed until run
  7. time.  @hemlock supports interactive programming in @llisp by providing
  8. incremental redefinition and environment examination commands.  @hemlock also
  9. uses Unix TCP sockets to support multiple Lisp processes, each of which may be
  10. on any machine.
  11.  
  12.  
  13. @section[Eval Servers]
  14. @label[eval-servers]
  15. @index[eval servers]
  16.  
  17. @hemlock runs in the editor process and interacts with other Lisp processes
  18. called @i[eval servers].  A user's Lisp program normally runs in an eval
  19. server process.  The separation between editor and eval server has several
  20. advantages:
  21. @begin[itemize]
  22. The editor is protected from any bad things which may happen while debugging a
  23. Lisp program.
  24.  
  25. Editing may occur while running a Lisp program.
  26.  
  27. The eval server may be on a different machine, removing the load from the
  28. editing machine.
  29.  
  30. Multiple eval servers allow the use of several distinct Lisp environments.
  31. @end[itemize]
  32. Instead of providing an interface to a single Lisp environment, @hemlock
  33. coordinates multiple Lisp environments.
  34.  
  35.  
  36. @subsection[The Current Eval Server]
  37. @index[current eval server]
  38. Although @hemlock can be connected to several eval servers simultaneously, one
  39. eval server is designated as the @i[current eval server].  This is the eval
  40. server used to handle evaluation and compilation requests.  Eval servers are
  41. referred to by name so that there is a convenient way to discriminate between
  42. servers when the editor is connected to more than one.  The current eval server
  43. is normally globally specified, but it may also be shadowed locally in specific
  44. buffers.
  45.  
  46. @defcom[com "Set Eval Server"]
  47. @defcom1[com "Set Buffer Eval Server"]
  48. @defcom1[com "Current Eval Server"]
  49. @hid[Set Eval Server] prompts for the name of an eval server and makes it the
  50. the current eval server.  @hid[Set Buffer Eval Server] is the same except that
  51. is sets the eval server for the current buffer only.  @hid[Current Eval Server]
  52. displays the name of the current eval server in the echo area, taking any
  53. buffer eval server into consideration.  See also @comref[Set Compile Server].
  54. @enddefcom
  55.  
  56.  
  57. @subsection[Slaves]
  58. @index[slave buffers]
  59. @index[slaves]
  60. For now, all eval servers are @i[slaves].  A slave is a Lisp process that uses
  61. a typescript (see page @pageref[typescripts]) to run its top-level
  62. @f[read-eval-print] loop in a @hemlock buffer.  We refer to the buffer that a
  63. slave uses for I/O as its @i[interactive] or @i[slave] buffer.  The name of the
  64. interactive buffer is the same as the eval server's name.
  65.  
  66. @index[background buffers]
  67. @hemlock creates a @i[background] buffer for each eval server.  The background
  68. buffer's name is @w<@hid[Background ]@i{name}>, where @i[name] is the name of
  69. the eval server.  Slaves direct compiler warning output to the background
  70. buffer to avoid cluttering up the interactive buffer.
  71.  
  72. @hemlock locally sets @hid[Current Eval Server] in interactive and background
  73. buffers to their associated slave.  When in a slave or background buffer, eval
  74. server requests will go to the associated slave, regardless of the global value
  75. of @hid[Current Eval Server].
  76.  
  77. @defcom[com "Select Slave", bind (C-M-c)]
  78. This command changes the current buffer to the current eval server's
  79. interactive buffer.  If the current eval server is not a slave, then it beeps.
  80. If there is no current eval server, then this creates a slave (see section
  81. @ref[slave-creation]).  If a prefix argument is supplied, then this creates a
  82. new slave regardless of whether there is a current eval server.  This command
  83. is the standard way to create a slave.
  84.  
  85. The slave buffer is a typescript (see page @pageref[typescripts]) the slave
  86. uses for its top-level @f[read-eval-print] loop.
  87. @enddefcom
  88.  
  89. @defcom[com "Select Background", bind (C-M-C)]
  90. This command changes the current buffer to the current eval server's background
  91. buffer.  If there is no current eval server, then it beeps.
  92. @enddefcom
  93.  
  94.  
  95. @subsection[Slave Creation and Destruction]
  96. @label[slave-creation]
  97. When @hemlock first starts up, there is no current eval server.  If there is no
  98. a current eval server, commands that need to use the current eval server will
  99. create a slave as the current eval server.
  100.  
  101. If an eval server's Lisp process terminates, then we say the eval server is
  102. dead.  @hemlock displays a message in the echo area, interactive, and
  103. background buffers whenever an eval server dies.  If the user deletes an
  104. interactive or background buffer, the associated eval server effectively
  105. becomes impotent, but @hemlock does not try to kill the process.  If a command
  106. attempts to use a dead eval server, then the command will beep and display a
  107. message.
  108.  
  109. @defhvar[var "Confirm Slave Creation", val {t}]
  110. If this variable is true, then @hemlock always prompts the user for
  111. confirmation before creating a slave.
  112. @enddefhvar
  113.  
  114. @defhvar[var "Ask About Old Servers", val {t}]
  115. If this variable is true, and some slave already exists, @hemlock prompts the
  116. user for the name of an existing server when there is no current server,
  117. instead of creating a new one.
  118. @enddefhvar
  119.  
  120. @defcom[com "Editor Server Name"]
  121. This command echos the editor server's name, the machine and port of the
  122. editor, which is suitable for use with the Lisp processes -slave switch.
  123. See section @ref[slave-switch].
  124. @enddefcom
  125.  
  126. @defcom[com "Accept Slave Connections"]
  127. This command cause @hemlock to accept slave connections, and it displays the
  128. editor server's name, which is suitable for use with the Lisp processes -slave
  129. switch.  See section @ref[slave-switch].  Supplying an argument causes this
  130. command to inhibit slave connections.
  131. @enddefcom
  132.  
  133. @defhvar[var "Slave Utility", val {"/usr/misc/.lisp/bin/lisp"}]
  134. @defhvar1[var "Slave Utility Switches"]
  135. A slave is started by running the program @hid[Slave Utility Name] with
  136. arguments specified by the list of strings @hid[Slave Utility Switches].  This
  137. is useful primarily when running customized Lisp systems.  For example,
  138. setting @hid[Slave Utility Switches] to @f[("-core" "my.core")] will cause
  139. "@f[/usr/hqb/my.core]" to be used instead of the default core image.
  140.  
  141. The @f[-slave] switch and the editor name are always supplied as arguments, and
  142. should remain unspecified in @hid[Slave Utility Switches].
  143. @enddefhvar
  144.  
  145. @defcom[com "Kill Slave"]
  146. @defcom1[com "Kill Slave and Buffers"]
  147. @hid[Kill Slave] prompts for a slave name, aborts any operations in the slave,
  148. tells the slave to @f[quit], and shuts down the connection to the specified
  149. eval server.  This makes no attempt to assure the eval server actually dies.
  150.  
  151. @hid[Kill Slave and Buffers] is the same as @hid[Kill Slave], but it also
  152. deletes the interactive and background buffers.
  153. @enddefcom
  154.  
  155.  
  156. @subsection[Eval Server Operations]
  157.  
  158. @label[operations]
  159. @index[eval server operations]@index[operations, eval server]
  160. @hemlock handles requests for compilation or evaluation by queuing an
  161. @i[operation] on the current eval server.  Any number of operations may be
  162. queued, but each eval server can only service one operation at a time.
  163. Information about the progress of operations is displayed in the echo area.
  164.  
  165. @defcom[com "Abort Operations", bind (C-c a)]
  166. This command aborts all operations on the current eval server, either queued or
  167. in progress.  Any operations already in the @f[Aborted] state will be flushed.
  168. @enddefcom
  169.  
  170. @defcom[com "List Operations", bind (C-c l)]
  171. This command lists all operations which have not yet completed.  Along with a
  172. description of the operation, the state and eval server is displayed.  The
  173. following states are used:
  174. @begin[description]
  175. @f[Unsent]@\The operation is in local queue in the editor, and hasn't been sent
  176. yet.
  177.  
  178. @f[Pending]@\The operation has been sent, but has not yet started execution.
  179.  
  180. @f[Running]@\The operation is currently being processed.
  181.  
  182. @f[Aborted]@\The operation has been aborted, but the eval server has not yet
  183. indicated termination.
  184. @end[description]
  185. @enddefcom
  186.  
  187.  
  188. @section[Typescripts]
  189. @label[typescripts]
  190. @index[typescripts]
  191.  
  192. Both slave buffers and background buffers are typescripts.  The typescript
  193. protocol allows other processes to do stream-oriented interaction in a @hemlock
  194. buffer similar to that of a terminal.  When there is a typescript in a buffer,
  195. the @hid[Typescript] minor mode is present.  Some of the commands described in
  196. this section are also used by @hid[Eval] mode (page @pageref[eval-mode].)
  197.  
  198. Typescripts are simple to use.  @hemlock inserts output from the process into
  199. the buffer.  To give the process input, use normal editing to insert the input
  200. at the end of the buffer, and then type @bf[Return] to confirm sending the
  201. input to the process.
  202.  
  203. @defcom[com "Confirm Typescript Input", 
  204.         stuff (bound to @bf[Return] in @hid[Typescript] mode)]
  205. @defhvar1[var "Unwedge Interactive Input Confirm", val {t}]
  206. This command sends text that has been inserted at the end of the current buffer
  207. to the process reading on the buffer's typescript.  Before sending the text,
  208. @hemlock moves the point to the end of the buffer and inserts a newline.
  209.  
  210. Input may be edited as much as is desired before it is confirmed; the result
  211. of editing input after it has been confirmed is unpredictable.  For this reason,
  212. it is desirable to postpone confirming of input until it is actually complete.
  213. The @hid[Indent New Line] command is often useful for inserting newlines
  214. without confirming the input.
  215.  
  216. If the process reading on the buffer's typescript is not waiting for input,
  217. then the text is queued instead of being sent immediately.  Any number of
  218. inputs may be typed ahead in this fashion.  @hemlock makes sure that the inputs
  219. and outputs get interleaved correctly so that when all input has been read, the
  220. buffer looks the same as it would have if the input had not been typed ahead.
  221.  
  222. If the buffer's point is before the start of the input area, then various
  223. actions can occur.  When set, @hid[Unwedge Interactive Input Confirm] causes
  224. @hemlock to ask the user if it should fix the input buffer which typically
  225. results in ignoring any current input and refreshing the input area at the end
  226. of the buffer.  This also has the effect of throwing the slave Lisp to top
  227. level, which aborts any pending operations or queued input.  This is the only
  228. way to be sure the user is cleanly set up again after messing up the input
  229. region.  When this is @nil, @hemlock simply beeps and tells the user in the
  230. @hid[Echo Area] that the input area is invalid.
  231. @enddefcom
  232.  
  233. @defcom[com "Kill Interactive Input", 
  234.     stuff (bound to @bf[M-i] in @hid[Typescript] and @hid[Eval] modes)]
  235. This command kills any input that would have been confirmed by @bf[Return].
  236. @enddefcom
  237.  
  238. @defcom[com "Next Interactive Input",  
  239.         stuff (bound to @bf[M-n] in @hid[Typescript] and @hid[Eval] modes)]
  240. @defcom1[com "Previous Interactive Input",
  241.         stuff (bound to @bf[M-p] in @hid[Typescript] and @hid[Eval] modes)]
  242. @defcom1[com "Search Previous Interactive Input",
  243.     stuff (bound to @bf[M-P] in @hid[Typescript] and @hid[Eval] modes)]
  244. @defhvar1[var "Interactive History Length", val {10}]
  245. @defhvar1[var "Minimum Interactive Input Length", val {2}]
  246. @index[history, typescript]
  247. @Hemlock maintains a history of interactive inputs.  @hid[Next Interactive
  248. Input] and @hid[Previous Interactive Input] step forward and backward in the
  249. history, inserting the current entry in the buffer.  The prefix argument is
  250. used as a repeat count.
  251.  
  252. @hid[Search Previous Interactive Input] searches backward through the
  253. interactive history using the current input as a search string.  Consecutive
  254. invocations repeat the previous search.
  255.  
  256. @hid[Interactive History Length] determines the number of entries with which
  257. @hemlock creates the buffer-specific histories.  @Hemlock only adds an input
  258. region to the history if its number of characters exceeds @hid[Minimum
  259. Interactive Input Length].
  260. @enddefcom
  261.  
  262. @defcom[com "Reenter Interactive Input",
  263.     stuff (bound to @bf[C-Return] in @hid[Typescript] and @hid[Eval] modes)]
  264.  This copies to the end of the buffer the form to the left of the buffer's
  265. point.  When the current region is active, this copies it instead.  This is
  266. sometimes easier to use to get a previous input that is either so far back that
  267. it has fallen off the history or is visible and more readily @i[yanked] than
  268. gotten with successive invocations of the history commands.
  269. @enddefcom
  270.  
  271. @defcom[com "Interactive Beginning of Line", 
  272.         stuff (bound to @bf[C-a] in @hid[Typescript] and @hid[Eval] modes)]
  273. This command is identical to @hid[Beginning of Line] unless there is no
  274. prefix argument and the point is on the same line as the start of the current
  275. input; then it moves to the beginning of the input.  This is useful since it
  276. skips over any prompt which may be present.
  277. @enddefcom
  278.  
  279. @defhvar[var "Input Wait Alarm", val {:loud-message}]
  280. @defhvar1[var "Slave GC Alarm", val {:message}]
  281. @hid[Input Wait Alarm] determines what action to take when a slave Lisp goes
  282. into an input wait on a typescript that isn't currently displayed in any
  283. window.  @hid[Slave GC Alarm] determines what action to take when a slave
  284. notifies that it is GC'ing.
  285.  
  286. The following are legal values:
  287. @begin[description]
  288. @kwd[loud-message]@\Beep and display a message in the echo area indicating
  289. which buffer is waiting for input.
  290.  
  291. @kwd[message]@\Display a message, but don't beep.
  292.  
  293. @nil@\Don't do anything.
  294. @end[description]
  295. @enddefhvar
  296.  
  297. @defcom[com "Typescript Slave BREAK", bind (Typescript: H-b)]
  298. @defcom1[com "Typescript Slave to Top Level", bind (Typescript: H-g)]
  299. @defcom1[com "Typescript Slave Status", bind (Typescript: H-s)]
  300. Some typescripts have associated information which these commands access
  301. allowing @hemlock to control the process which uses the typescript.
  302.  
  303. @hid[Typescript Slave BREAK] puts the current process in a break loop so that
  304. you can be debug it.  This is similar in effect to an interrupt signal (@f[^C]
  305. or @f[^\] in the editor process).
  306.  
  307. @hid[Typescript Slave to Top Level] causes the current process to throw to the
  308. top-level @f[read-eval-print] loop.  This is similar in effect to a quit signal
  309. (@f[^\]).
  310.  
  311. @hid[Typescript Slave Status] causes the current process to print status
  312. information on @var[error-output]:
  313. @lisp
  314. ; Used 0:06:03, 3851 faults.  In: SYSTEM:SERVE-EVENT
  315. @endlisp
  316. The message displays the process run-time, the total number of page faults and
  317. the name of the currently running function.   This command is useful for
  318. determining whether the slave is in an infinite loop, waiting for input, or
  319. whatever.
  320. @enddefcom
  321.  
  322.  
  323. @section[The Current Package]
  324. @label[lisp-package]
  325. @index[package]
  326. The current package is the package which Lisp interaction commands use.  The
  327. current package is specified on a per-buffer basis, and defaults to "@f[USER]".
  328. If the current package does not exist in the eval server, then it is created.
  329. If evaluation is being done in the editor process and the current package
  330. doesn't exist, then the value of @f[*package*] is used.  The current package is
  331. displayed in the modeline (see section @ref[modelines].)  Normally the package
  332. for each file is specified using the @f[Package] file option (see page
  333. @pageref[file-options].)
  334.  
  335. When in a slave buffer, the current package is controlled by the value of
  336. @var[package] in that Lisp process.  Modeline display of the current package
  337. is inhibited in this case.
  338.  
  339. @defcom[com "Set Buffer Package"]
  340. This command prompts for the name of a package to make the local package in the
  341. current buffer.  If the current buffer is a slave, background, or eval buffer,
  342. then this sets the current package in the associated eval server or editor
  343. Lisp.  When in an interactive buffer, do not use @f[in-package]; use this
  344. command instead.
  345. @enddefcom
  346.  
  347.  
  348. @section[Compiling and Evaluating Lisp Code]
  349.  
  350. @index[compilation]@index[evaluation]These commands can greatly speed up
  351. the edit/debug cycle since they enable incremental reevaluation or
  352. recompilation of changed code, avoiding the need to compile and load an
  353. entire file.  
  354.  
  355. @defcom[com "Evaluate Expression", bind (M-Escape)]
  356. This command prompts for an expression and prints the result of its evaluation
  357. in the echo area.  If an error happens during evaluation, the evaluation is
  358. simply aborted, instead of going into the debugger.  This command doesn't
  359. return until the evaluation is complete.
  360. @enddefcom
  361.  
  362. @defcom[com "Evaluate Defun", bind (C-x C-e)]
  363. @defcom1[com "Evaluate Region"]
  364. @defcom1[com "Evaluate Buffer"]
  365. These commands evaluate text out of the current buffer, reading the current
  366. defun, the region and the entire buffer, respectively.  The result of the
  367. evaluation of each form is displayed in the echo area.  If the region is
  368. active, then @hid[Evaluate Defun] evaluates the current region, just like 
  369. @hid[Evaluate Region].
  370. @enddefcom
  371.  
  372. @defcom[com "Macroexpand Expression", bind (C-M)]
  373. This command shows the macroexpansion of the next expression in the null
  374. environment in a pop-up window.  With an argument, it uses @f[macroexpand]
  375. instead of @f[macroexpand-1].
  376. @enddefcom
  377.  
  378. @defcom[com "Re-evaluate Defvar"]
  379. This command is similar to @hid[Evaluate Defun].  It is used for force the
  380. re-evaluation of a @f[defvar] init form.  If the current top-level form is a
  381. @f[defvar], then it does a @f[makunbound] on the variable, and evaluates the
  382. form.
  383. @enddefcom
  384.  
  385. @defcom[com "Compile Defun", bind (C-x C-c)]
  386. @defcom1[com "Compile Region"]
  387. These commands compile the text in the current defun and the region,
  388. respectively.  If the region is active, then @hid[Compile Defun] compiles the
  389. current region, just like @hid[Compile Region].
  390. @enddefcom
  391.  
  392. @defcom[com "Load File"]
  393. @defhvar1[var "Load Pathname Defaults", val {nil}]
  394. This command prompts for a file and loads it into the current eval server using
  395. @f[load].  @hid[Load Pathname Defaults] contains the default pathname for this
  396. command.  This variable is set to the file loaded; if it is @nil, then there is
  397. no default.  This command also uses the @hid[Remote Compile File] variable.
  398. @enddefcom
  399.  
  400.  
  401. @section[Compiling Files]
  402. These commands are used to compile source ("@f[.lisp]") files, producing binary
  403. ("@f[.fasl]") output files.  Note that unlike the other compiling and evalating
  404. commands, this does not have the effect of placing the definitions in the
  405. environment; to do so, the binary file must be loaded.
  406.  
  407. @defcom[com "Compile Buffer File", bind (C-x c)]
  408. @defhvar1[var "Compile Buffer File Confirm", val {t}]
  409. This command asks for confirmation, then saves the current buffer (when
  410. modified) and compiles the associated file.  The confirmation prompt indicates
  411. intent to save and compile or just compile.  If the buffer wasn't modified, and
  412. a comparison of the write dates for the source and corresponding binary
  413. ("@f[.fasl]") file suggests that recompilation is unnecessary, the confirmation
  414. also indicates this.  A prefix argument overrides this test and forces
  415. recompilation.  Since there is a complete log of output in the background
  416. buffer, the creation of the normal error output ("@f[.err]") file is inhibited.
  417.  
  418. Setting @hid[Compile Buffer File Confirm] to @nil inhibits confirmation, except
  419. when the binary is up to date and a prefix argument is not supplied.
  420. @enddefcom
  421.  
  422. @defcom[com "Compile File"]
  423. This command prompts for a file and compiles that file, providing a convenient
  424. way to compile a file that isn't in any buffer.  Unlike 
  425. @hid[Compile Buffer File], this command doesn't do any consistency checks such
  426. as checking whether the source is in a modified buffer or the binary is up to
  427. date.
  428. @enddefcom
  429.  
  430. @defcom[com "Compile Group"]
  431. @defcom1[com "List Compile Group"]
  432. @label[compile-group-command]@index[group, compilation]@hid[Compile Group] does
  433. a @hid[Save All Files] and then compiles every "@f[.lisp]" file for which the
  434. corresponding "@f[.fasl]" file is older or nonexistent.  The files are compiled
  435. in the order in which they appear in the group definition.  A prefix argument
  436. forces compilation of all "@f[.lisp]" files.
  437.  
  438. @hid[List Compile Group] lists any files that would be compiled by
  439. @hid[Compile Group].  All Modified files are saved before checking to generate
  440. a consistent list.
  441. @enddefcom 
  442.  
  443. @defcom[com "Set Compile Server"]
  444. @defcom1[com "Set Buffer Compile Server"]
  445. @defcom1[com "Current Compile Server"]
  446. These commands are analogous to @hid[Set Eval Server], @comref[Set Buffer Eval
  447. Server] and @hid[Current Eval Server], but they determine the eval server used
  448. for file compilation requests.  If the user specifies a compile server, then
  449. the file compilation commands send compilation requests to that server instead
  450. of the current eval server.
  451.  
  452. Having a separate compile server makes it easy to do compilations in the
  453. background while continuing to interact with your eval server and editor.  The
  454. compile server can also run on a remote machine relieving your active
  455. development machine of the compilation effort.
  456. @enddefcom
  457.  
  458. @defcom[com "Next Compiler Error", bind (H-n)]
  459. @defcom1[com "Previous Compiler Error", bind (H-p)]
  460. These commands provides a convenient way to inspect compiler errors.  First it
  461. splits the current window if there is only one window present.  @hemlock
  462. positions the current point in the first window at the erroneous source code
  463. for the next (or previous) error.  Then in the second window, it displays the
  464. error beginning at the top of the window.  Given an argument, this command
  465. skips that many errors.
  466. @enddefcom
  467.  
  468. @defcom[com "Flush Compiler Error Information"]
  469. This command relieves the current eval server of all infomation about errors
  470. encountered while compiling.  This is convenient if you have been compiling a
  471. lot, but you were ignoring errors and warnings.  You don't want to step through
  472. all the old errors, so you can use this command immediately before compiling a
  473. file whose errors you intend to edit.
  474. @enddefcom
  475.  
  476.  
  477. @defhvar[var "Remote Compile File", val {nil}]
  478. When true, this variable causes file compilations to be done using the RFS
  479. remote file system mechanism by prepending "@f[/../]@i[host]" to the file being
  480. compiled.  This allows the compile server to be run on a different machine, but
  481. requires that the source be world readable.  If false, commands use source
  482. filenames directly.  Do NOT use this to compile files in AFS.
  483. @enddefhvar
  484.  
  485.  
  486. @section[Querying the Environment]
  487. @index[documentation, lisp]
  488. These commands are useful for obtaining various random information from the
  489. Lisp environment.
  490.  
  491. @defcom[com "Describe Function Call", bind (C-M-A)]
  492. @defcom1[com "Describe Symbol", bind (C-M-S)]
  493. @hid[Describe Function Call] uses the current eval server to describe the
  494. symbol found at the head of the currently enclosing list, displaying the output
  495. in a pop-up window.  @hid[Describe Symbol] is the same except that it describes
  496. the symbol at or before the point.  These commands are primarily useful for
  497. finding the documentation for functions and variables.  If there is no
  498. currently valid eval server, then this command uses the editor Lisp's
  499. environment instead of trying to spawn a slave.
  500. @enddefcom
  501.  
  502.  
  503. @section[Editing Definitions]
  504. The Lisp compiler annotates each compiled function object with the source
  505. file that the function was originally defined from.  The definition editing
  506. commands use this information to locate and edit the source for functions
  507. defined in the environment.
  508.  
  509. @defcom[com "Edit Definition"]
  510. @defcom1[com "Goto Definition", bind (C-M-F)]
  511. @defcom1[com "Edit Command Definition"]
  512. @hid[Edit Definition] prompts for the name of a function, and then uses the
  513. current eval server to find out in which file the function is defined.  If
  514. something other than @f[defun] or @f[defmacro] defined the function, then this
  515. simply reads in the file, without trying to find its definition point within
  516. the file.  If the function is uncompiled, then this looks for it in the current
  517. buffer.  If there is no currently valid eval server, then this command uses the
  518. editor Lisp's environment instead of trying to spawn a slave.
  519.  
  520. @hid[Goto Definition] edits the definition of the symbol at the beginning of
  521. the current list.
  522.  
  523. @hid[Edit Command Definition] edits the definition of a @hemlock command.  By
  524. default, this command does a keyword prompt for the command name (as in an
  525. extended command).  If a prefix argument is specified, then instead prompt for
  526. a key and edit the definition of the command bound to that key.
  527. @enddefcom
  528.  
  529. @defcom[com "Add Definition Directory Translation"]
  530. @defcom1[com "Delete Definition Directory Translation"]
  531. The defining file is recorded as an absolute pathname.  The definition editing
  532. commands have a directory translation mechanism that allow the sources to be
  533. found when they are not in the location where compilation was originally done.
  534. @hid[Add Definition Directory Translation] prompts for two directory
  535. namestrings and causes the first to be mapped to the second.  Longer (more
  536. specific) directory specifications are matched before shorter (more general)
  537. ones.
  538.  
  539. @hid[Delete Definition Directory Translation] prompts for a directory
  540. namestring and deletes it from the directory translation table.
  541. @enddefcom
  542.  
  543. @defhvar[var "Editor Definition Info", val {nil}]
  544. When this variable is true, the editor Lisp is used to determine definition
  545. editing information, otherwise the current eval server is used.  This variable
  546. is true in @hid[Eval] and @hid[Editor] modes.
  547. @enddefhvar
  548.  
  549.  
  550. @section[Debugging]
  551. These commands manipulate the slave when it is in the debugger and provide
  552. source editing based on the debugger's current frame.  These all affect the
  553. @hid[Current Eval Server].
  554.  
  555.  
  556. @subsection[Changing Frames]
  557.  
  558. @defcom[com "Debug Down", bind (C-M-H-d)]
  559. This command moves down one debugger frame.
  560. @enddefcom
  561.  
  562. @defcom[com "Debug Up", bind (C-M-H-u)]
  563. This command moves up one debugger frame.
  564. @enddefcom
  565.  
  566. @defcom[com "Debug Top", bind (C-M-H-t)]
  567. This command moves to the top of the debugging stack.
  568. @enddefcom
  569.  
  570. @defcom[com "Debug Bottom", bind (C-M-H-b)]
  571. This command moves to the bottom of the debugging stack.
  572. @enddefcom
  573.  
  574. @defcom[com "Debug Frame", bind (C-M-H-f)]
  575. This command moves to the absolute debugger frame number indicated by the
  576. prefix argument.
  577. @enddefcom
  578.  
  579.  
  580. @subsection[Getting out of the Debugger]
  581.  
  582. @defcom[com "Debug Quit", bind (C-M-H-q)]
  583. This command throws to top level out of the debugger in the @hid[Current Eval
  584. Server].
  585. @enddefcom
  586.  
  587. @defcom[com "Debug Go", bind (C-M-H-g)]
  588. This command tries the @f[continue] restart in the @hid[Current Eval Server].
  589. @enddefcom
  590.  
  591. @defcom[com "Debug Abort", bind (C-M-H-a)]
  592. This command executes the ABORT restart in the @hid[Current Eval Server].
  593. @enddefcom
  594.  
  595. @defcom[com "Debug Restart", bind (C-M-H-r)]
  596. This command executes the restart indicated by the prefix argument in the
  597. @hid[Current Eval Server].  The debugger enumerates the restart cases upon
  598. entering it.
  599. @enddefcom
  600.  
  601.  
  602. @subsection[Getting Information]
  603.  
  604. @defcom[com "Debug Help", bind (C-M-H-h)]
  605. This command in prints the debugger's help text.
  606. @enddefcom
  607.  
  608. @defcom[com "Debug Error", bind (C-M-H-e)]
  609. This command prints the error condition and restart cases displayed upon
  610. entering the debugger.
  611. @enddefcom
  612.  
  613. @defcom[com "Debug Backtrace", bind (C-M-H-B)]
  614. This command executes the debugger's @f[backtrace] command.
  615. @enddefcom
  616.  
  617. @defcom[com "Debug Print", bind (C-M-H-p)]
  618. This command prints the debugger's current frame in the same fashion as the
  619. frame motion commands.
  620. @enddefcom
  621.  
  622. @defcom[com "Debug Verbose Print", bind (C-M-H-P)]
  623. This command prints the debugger's current frame without elipsis.
  624. @enddefcom
  625.  
  626. @defcom[com "Debug Source", bind (C-M-H-s)]
  627. This command prints the source form for the debugger's current frame.
  628. @enddefcom
  629.  
  630. @defcom[com "Debug Verbose Source"]
  631. This command prints the source form for the debugger's current frame with
  632. surrounding forms for context.
  633. @enddefcom
  634.  
  635. @defcom[com "Debug List Locals", bind (C-M-H-l)]
  636. This prints the local variables for the debugger's current frame.
  637. @enddefcom
  638.  
  639.  
  640. @subsection[Editing Sources]
  641.  
  642. @defcom[com "Debug Edit Source", bind (C-M-H-S)]
  643. This command attempts to place you at the source location of the debugger's
  644. current frame.  Not all debugger frames represent function's that were compiled
  645. with the appropriate debug-info policy.  This beeps with a message if it is
  646. unsuccessful.
  647. @enddefcom
  648.  
  649.  
  650. @subsection[Miscellaneous]
  651.  
  652. @defcom[com "Debug Flush Errors", bind (C-M-H-F)]
  653. This command toggles whether the debugger ignores errors or recursively enters
  654. itself.
  655. @enddefcom
  656.  
  657.  
  658.  
  659.  
  660. @section[Manipulating the Editor Process]
  661. When developing @hemlock customizations, it is useful to be able to manipulate
  662. the editor Lisp environment from @hemlock.
  663.  
  664. @defcom[com "Editor Describe", bind (Home t, C-_ t)]
  665. This command prompts for an expression, and then evaluates and describes it
  666. in the editor process.
  667. @enddefcom
  668.  
  669. @defcom[com "Room"]
  670. Call the @f[room] function in the editor process, displaying information
  671. about allocated storage in a pop-up window.
  672. @enddefcom
  673.  
  674. @defcom[com "Editor Load File"]
  675. This command is analogous to @comref[Load File], but loads the file into the
  676. editor process.
  677. @enddefcom
  678.  
  679.  
  680. @subsection[Editor Mode]
  681. When @hid[Editor] mode is on, alternate versions of the Lisp interaction
  682. commands are bound in place of the eval server based commands.  These commands
  683. manipulate the editor process instead of the current eval server.  Turning on
  684. editor mode in a buffer allows incremental development of code within the
  685. running editor.
  686.  
  687. @defcom[com "Editor Mode"]
  688. This command turns on @hid[Editor] minor mode in the current buffer.  If it is
  689. already on, it is turned off.  @hid[Editor] mode may also be turned on using
  690. the @f[Mode] file option (see page @pageref[file-options].)
  691. @enddefcom
  692.  
  693. @defcom[com "Editor Compile Defun",
  694.     stuff (bound to @bf[C-x C-c] in @hid[Editor] mode)]
  695. @defcom1[com "Editor Compile Region"]
  696. @defcom1[com "Editor Evaluate Buffer"]
  697. @defcom1[com "Editor Evaluate Defun",
  698.     stuff (bound to @bf[C-x C-e] in @hid[Editor] mode)]
  699. @defcom1[com "Editor Evaluate Region"]
  700. @defcom1[com "Editor Macroexpand Expression", bind (Editor: C-M)]
  701. @defcom1[com "Editor Re-evaluate Defvar"]
  702. @defcom1[com "Editor Describe Function Call",
  703.     stuff (bound to @bf[C-M-A] in @hid[Editor] mode)]
  704. @defcom1[com "Editor Describe Symbol",
  705.     stuff (bound to @bf[C-M-S] in @hid[Editor] mode)]
  706. These commands are similar to the standard commands, but modify or examine the
  707. Lisp process that @hemlock is running in.  Terminal I/O is done on the
  708. initial window for the editor's Lisp process.  Output is directed to a pop-up
  709. window or the editor's window instead of to the background buffer.
  710. @enddefcom
  711.  
  712. @defcom[com "Editor Compile Buffer File"]
  713. @defcom1[com "Editor Compile File"]
  714. @defcom1[com "Editor Compile Group"]
  715. In addition to compiling in the editor process, these commands differ from the
  716. eval server versions in that they direct output to the the 
  717. @hid[Compiler Warnings] buffer.
  718. @enddefcom
  719.  
  720. @defcom[com "Editor Evaluate Expression",
  721.      stuff (bound to @bf[M-Escape] in @hid[Editor] mode and @bf[C-M-Escape])] 
  722. This command prompts for an expression and evaluates it in the editor process.
  723. The results of the evaluation are displayed in the echo area.
  724. @enddefcom
  725.  
  726.  
  727. @subsection[Eval Mode]
  728. @label[eval-mode]
  729. @index[modes, eval]@hid[Eval] mode is a minor mode that simulates a @f[read]
  730. @f[eval] @f[print] loop running within the editor process.  Since Lisp
  731. program development is usually done in a separate eval server process (see page
  732. @pageref[eval-servers]), @hid[Eval] mode is used primarily for debugging code
  733. that must run in the editor process.  @hid[Eval] mode shares some commands with
  734. @hid[Typescript] mode: see section @ref[typescripts].
  735.  
  736. @hid[Eval] mode doesn't completely support terminal I/O: it binds
  737. @var[standard-output] to a stream that inserts into the buffer and
  738. @var[standard-input] to a stream that signals an error for all operations.
  739. @hemlock cannot correctly support the interactive evaluation of forms that read
  740. from the @hid[Eval] interactive buffer.
  741.  
  742. @defcom[com "Select Eval Buffer"]
  743. This command changes to the @hid[Eval] buffer, creating one if it doesn't
  744. already exist.  The @hid[Eval] buffer is created with @hid[Lisp] as the major
  745. mode and @hid[Eval] and @hid[Editor] as minor modes. 
  746. @enddefcom
  747.  
  748. @defcom[com "Confirm Eval Input",
  749.         stuff (bound to @bf[Return] in @hid[Eval] mode)]
  750. This command evaluates all the forms between the end of the last output and
  751. the end of the buffer, inserting the results of their evaluation in the buffer.
  752. This beeps if the form is incomplete.  Use @binding[Linefeed] to insert line
  753. breaks in the middle of a form.
  754.  
  755. This command uses @hid[Unwedge Interactive Input Confirm] in the same way
  756. @hid[Confirm Interactive Input] does.
  757. @enddefcom
  758.  
  759. @defcom[com "Abort Eval Input", 
  760.         stuff (bound to @bf[M-i] in @hid[Eval] mode)]
  761. This command moves the the end of the buffer and prompts, ignoring any
  762. input already typed in.
  763. @enddefcom
  764.  
  765.  
  766. @subsection[Error Handling]
  767. @index[error handling]
  768. When an error happens inside of @hemlock, @hemlock will trap the error and
  769. display the error message in the echo area, possibly along with the
  770. "@f[Internal error:]" prefix.  If you want to debug the error, type @bf[?].
  771. This causes the prompt "@f[Debug:]" to appear in the echo area.  The following
  772. commands are recognized:
  773. @begin[description]
  774. @bf[d]@\Enter a break-loop so that you can use the Lisp debugger.
  775. Proceeding with "@f[go]" will reenter @hemlock and give the "@f[Debug:]"
  776. prompt again.
  777.  
  778. @bf[e]@\Display the original error message in a pop-up window.
  779.  
  780. @bf[b]@\Show a stack backtrace in a pop-up window.
  781.  
  782. @bf[q, Escape]@\Quit from this error to the nearest command loop.
  783.  
  784. @bf[r]@\Display a list of the restart cases and prompt for the number of a
  785. @f[restart-case] with which to continue.  Restarting may result in prompting in
  786. the window in which Lisp started.
  787. @end[description]
  788.  
  789. Only errors within the editor process are handled in this way.  Errors during
  790. eval server operations are handled using normal terminal I/O on a typescript in
  791. the eval server's slave buffer or background buffer (see page
  792. @pageref[operations]).  Errors due to interaction in a slave buffer will cause
  793. the debugger to be entered in the slave buffer.
  794.  
  795.  
  796. @section[Command Line Switches]
  797. @label[slave-switch]
  798. Two command line switches control the initialization of editor and eval servers
  799. for a Lisp process:
  800. @begin[description]
  801. @f<-edit>@\
  802. @label[edit-switch]
  803. This switch starts up @hemlock.  If there is a non-switch command line word
  804. immediately following the program name, then the system interprets it as a file
  805. to edit.  For example, given
  806. @Begin[ProgramExample]
  807. lisp file.txt -edit
  808. @End[ProgramExample]
  809. Lisp will go immediately into @hemlock finding the file @f[file.txt].
  810.  
  811. @f<-slave [>@i[name]@f<]>@\
  812.  This switch causes the Lisp process to become a slave of the editor process
  813. @i[name].  An editor Lisp determines @i[name] when it allows connections from
  814. slaves.  Once the editor chooses a name, it keeps the same name until the
  815. editor's Lisp process terminates.  Since the editor can automatically create
  816. slaves on its own machine, this switch is useful primarily for creating slaves
  817. that run on a different machine.  @f[hqb]'s machine is @f[ME.CS.CMU.EDU], and
  818. he wants want to run a slave on @f[SLAVE.CS.CMU.EDU], then he should use the
  819. @hid[Accept Slave Connections] command, telnet to the machine, and invoke Lisp
  820. supplying @f[-slave] and the editor's name.  The command displays the editor's
  821. name.
  822. @end[description]
  823.